home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v7n21.arc / DELETE.PAS < prev    next >
Pascal/Delphi Source File  |  1988-11-14  |  665b  |  28 lines

  1. PROGRAM Delete;
  2.  
  3. VAR
  4.   ioCode : Byte;
  5.   FileVar : FILE;
  6.   FileName : STRING[255];
  7.  
  8.   PROCEDURE ioError(ioCode : Byte);
  9.   BEGIN
  10.     Write(#7, 'I/O result of ', ioCode, ' (decimal) ', #26, ' ');
  11.     CASE ioCode OF
  12.       $01 : WriteLn('Filename not found.');
  13.       $20 : WriteLn('Illegal operation for a logical device.');
  14.       $F3 : WriteLn('Too many files open.');
  15.     ELSE WriteLn('Unknown I/O error.');
  16.     END;
  17.   END;
  18.  
  19. BEGIN
  20.   Write('Delete file : ');
  21.   ReadLn(FileName);
  22.   Assign(FileVar, FileName);
  23.   {$I-} Erase(FileVar);       {$I+}
  24.   ioCode := IOResult;
  25.   IF ioCode <> 0 THEN ioError(ioCode)
  26.   ELSE WriteLn('File deleted.')
  27. END.
  28.